
# Add source to this project's executable.
add_executable (engine 
  main.cpp
  SelahEngine.cpp
  SelahEngine.h  
  # vk_types.h
  # vk_initializers.cpp
  # vk_initializers.h
  # vk_images.h
  # vk_images.cpp 
  # vk_descriptors.h
  # vk_descriptors.cpp
  # vk_pipelines.h
  # vk_pipelines.cpp
  # vk_engine.h
  # vk_engine.cpp
  # vk_loader.h
  # vk_loader.cpp
  # camera.cpp
  # camera.h
)

set_property(TARGET engine PROPERTY CXX_STANDARD 20)
target_compile_definitions(engine PUBLIC GLFW_INCLUDE_VULKAN)
target_compile_definitions(engine PUBLIC GLM_FORCE_RADIANS)
target_compile_definitions(engine PUBLIC GLM_FORCE_DEPTH_ZERO_TO_ONE)
target_compile_definitions(engine PUBLIC GLM_FORCE_DEFAULT_ALIGNED_GENTYPE)
target_compile_definitions(engine PUBLIC STB_IMAGE_IMPLEMENTATION)
target_compile_definitions(engine PUBLIC TINYOBJLOADER_IMPLEMENTATION)

target_include_directories(engine PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")

# target_link_libraries(engine PUBLIC vma glm Vulkan::Vulkan fmt::fmt stb_image SDL2::SDL2 vkbootstrap imgui fastgltf::fastgltf)
target_link_libraries(engine glm Vulkan::Vulkan glfw stb_image vma tinyobj)

target_precompile_headers(engine PUBLIC <optional> <vector> <memory> <string> <vector> <unordered_map> <glm/mat4x4.hpp>  <glm/vec4.hpp> <vulkan/vulkan.h>)

# add_custom_command(TARGET engine POST_BUILD
#   COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:engine> $<TARGET_FILE_DIR:engine>
#   COMMAND_EXPAND_LISTS
#   COMMENT "only uncomment when at least one dll is linked"
#   )

# file(GLOB SPV_FILES "${PROJECT_SOURCE_DIR}/shaders/*.spv")
# foreach(SPV_FILE ${SPV_FILES})
#     get_filename_component(SPV_NAME ${SPV_FILE} NAME)
#     add_custom_command(TARGET engine POST_BUILD
#         COMMAND ${CMAKE_COMMAND} -E copy
#         ${SPV_FILE}
#         $<TARGET_FILE_DIR:engine>/shaders/${SPV_NAME})

add_custom_target(copy_assets
    COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/assets ${PROJECT_SOURCE_DIR}/bin/assets
)

add_dependencies(engine copy_assets)